<template>
	<view class="bank">
		<view class="card" v-for="item in inList" :key="item.id">
			<view class="flex">
				<view class="">
					<view class="b_t">
						{{item.bank_branch}}
					</view>
					<view class="b_n">
						储蓄卡
					</view>
				</view>
			</view>
			
			<view class="b_d">
				
			</view>
			
			<view class="flex  felx-y-c flex-x-b">
				<view class="card_num">
					{{item.bank_card_number}}
				</view>
				<view class="del_image" @click="del(item.id)">
					<image src="../../static/del.png" alt="">
				</view>
			</view>
			
		</view>
		
		
		<view class="btn" @click="bankCard">
			添加银行卡
		</view>
	</view>
</template>

<script>
	import * as Api from '@/api/recovery'
	export default{
		data(){
			return{
				inList:[]
			}
		},
		onShow() {
			this.getPageData()
		},
		methods:{
			bankCard(){
				uni.navigateTo({
					url:'/pages/bank/bind'
				})
			},
			getPageData(callback) {
			  const app = this
			  console.log(uni.getStorageSync('userId'))
			  // const pageId = app.options.pageId || 0
			  Api.bankList(
			  {
				  user_id:uni.getStorageSync('userId')
			  })
			    .then(result => {
				  console.log(result)
				  this.inList=result.data.list
			    })
			    .finally(() => callback && callback())
			},
			del(e){
				const app = this
				Api.bankdel(
				{
					id:e
				})
				  .then(result => {
					this.getPageData()
				  })
				  .finally(() => callback && callback())
			}
			
		}
	}
</script>

<style>
	.bank{
		padding: 25rpx 32rpx;
	}
	.card{
		padding: 33rpx 39rpx;
		background: #FFFFFF;
		border-radius: 20rpx;
		margin-bottom: 24rpx;
	}
	.flex {
		display: flex;
		align-items: center;
		justify-content: space-between;
	}
	.image_1{
		width: 65rpx;
		height: 67rpx;
	}
	.image_1 image{
		width: 100%;
		height: 100%;
	}
	.b_t{
		font-size: 32rpx;
		font-family: PingFang SC;
		font-weight: bold;
		color: #000000;
		letter-spacing:20rpx;
	}
	.b_n{
		font-size: 26rpx;
		font-family: PingFang SC;
		font-weight: 400;
		color: #000000;
		letter-spacing:20rpx;
		margin-top: 20rpx;
	}
	.b_d{
		width: 30rpx;
		height: 9rpx;
		background: #FFB823;
		margin: 20rpx 0;
	}
	
	.card_num{
		font-size: 34rpx;
		font-family: PingFang SC;
		font-weight: bold;
		color: #000000;
	}
	
	.btn{
		width: 686rpx;
		height: 88rpx;
		background: #66B347;
		border-radius: 44rpx;
		font-size: 32rpx;
		font-family: PingFang SC;
		font-weight: bold;
		color: #FFFFFF;
		margin: 0 auto;
		text-align: center;
		line-height: 88rpx;
		margin-top: 100rpx;
	}
	
	.del_image{
		width: 30rpx;
		height: 30rpx;
	}
	.del_image image{
		width: 100%;
		height: 100%;
	}
</style>